package top.lshaci.learning.alibaba.cloud.seata.account.api;

import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.lshaci.learning.alibaba.cloud.seata.account.service.AccountService;

/**
 * AccountController
 *
 * @author lshaci
 * @since 1.0.0
 */
@RestController
@AllArgsConstructor
@RequestMapping("/account")
public class AccountController {

    private final AccountService accountService;

    /**
     * 从用户账户中借出
     */
    @GetMapping("/debit/{userId}/{money}")
    public void debit(@PathVariable String userId, @PathVariable int money) {
        accountService.debit(userId, money);
    }
}
